#ifndef VEC4_H_
#define VEC4_H_

#include "../common.h"

#include "Vec.h"

namespace physicsworks {

namespace math {

template<class T> class Vec4 : public Vec<T> {
private:
	typedef Vec<T> Base;

public:
	T &x, &y, &z, &w;
	
	using Vec<T>::operator*;

	Vec4<T> () : Vec<T>(4), x(Base::arr[0]), y(Base::arr[1]), z(Base::arr[2]), w(Base::arr[3]) {}
	Vec4<T> (const Vec<T>& v) : Vec<T>(v), x(Base::arr[0]), y(Base::arr[1]), z(Base::arr[2]),
	                            w(Base::arr[3]) {}
	Vec4<T> (T X, T Y, T Z, T W) : Vec<T>(4), x(Base::arr[0]), y(Base::arr[1]), z(Base::arr[2]),
	                               w(Base::arr[3]) {
		x = X; y = Y; z = Z; w = W;
	}
	
	/**
	 * Returns the dot product.
	 */
	const T operator * (const Vec4<T>& v) const {
		T r = 0;
		for (size_t i = 0; i < 4; i++) {
			r += this->arr[i] * v.arr[i];
		}
		return r;
	}
};

}

}

#endif /*VEC4_H_*/
